#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <limits.h>

unsigned int
fancy_shift(unsigned int u, int k)
{
	return (u >> k)|(u << ((CHAR_BIT * sizeof u) - k));
}

int
main(int argc, char **argv)
{
	int n, k;
	unsigned int u;

	scanf("%d%d", &n, &k);
	u = (unsigned int) n;
	printf("%d\n", fancy_shift(u, k));

	return 0;
}
